package com.errol.batchprocessor.payroll.advisorimpl.payload;

import com.renjia.bo.ChannelFeeTypeBO;
import com.renjia.entity.*;
import com.renjia.enums.EmployeeRegisterSourceEnum;
import com.renjia.service.module.employeeaddition.advisorimpl.EmployeeAdvisorTypeEnum;
import com.renjia.service.module.employeeaddition.advisorimpl.payroll.payload.PayrollEmployeeBatchPayload;
import com.renjia.service.module.payroll.advisorimpl.PayrollAdvisorTypeEnum;
import com.renjia.service.module.payrollmanage.po.PayrollDetailExcelPO;
import com.renjia.service.module.payrollmanage.po.PayrollRecordPO;
import lombok.Getter;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zhang xiao bin
 * @version v1.0
 * @date 2021/03/16
 * @since v
 **/
@Getter
public class PayrollUploadBatchPayload extends PayrollEmployeeBatchPayload {

    private PayrollRecordPO payrollRecordPo;
    private List<? extends PayrollDetailExcelPO> payrollDetailExcelPoList;

    private List<String> errMsgList;
    private ChannelFeeTypeBO channelFeeTypeBo;

    public PayrollUploadBatchPayload(@NonNull String batchNo, @NonNull CoreEmployeeImportBatch importBatch,
                                     @Nullable BusPayrollRecord batchEntity, @NonNull List<BusPayrollRecordDetail> singleEntityList,
                                     @NonNull EmployeeAdvisorTypeEnum employeeAdvisorType, @NonNull EmployeeRegisterSourceEnum employeeRegisterSource,
                                     @NonNull CoreCustomerChannelMerchant coreCustomerChannelMerchant, @NonNull CoreUser coreUser,
                                     @Nullable CoreChannelMerchant coreChannelMerchant, @Nullable CoreCustomer coreCustomer,
                                     @NonNull PayrollAdvisorTypeEnum payrollAdvisorTypeEnum, @NonNull String demandId, @Nullable BusDemand busDemand,
                                     PayrollRecordPO payrollRecordPo, List<? extends PayrollDetailExcelPO> payrollDetailExcelPoList) {
        super(batchNo, importBatch, batchEntity, singleEntityList, employeeAdvisorType, employeeRegisterSource, coreCustomerChannelMerchant, coreUser,
                coreChannelMerchant, coreCustomer, payrollAdvisorTypeEnum, demandId, busDemand);
        this.payrollRecordPo = payrollRecordPo;
        this.payrollDetailExcelPoList = payrollDetailExcelPoList;
        this.errMsgList = new ArrayList<>();
    }

    public void clearCache() {
        payrollRecordPo = null;
        payrollDetailExcelPoList = null;
        errMsgList = null;
        channelFeeTypeBo = null;
    }

    public void setChannelFeeTypeBo(ChannelFeeTypeBO channelFeeTypeBo) {
        this.channelFeeTypeBo = channelFeeTypeBo;
    }
}
